<?php

namespace apiend\filters;

use Yii;
use common\filters\HttpBearerAuth;

/**
 * AppBearerAuth is an action filter that supports the authentication method based on HTTP Bearer token.
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class AppBearerAuth extends HttpBearerAuth {

    /**
     * @var array the HTTP authentication realm
     */
    public $accessAllows = [
        'passport/login/index'
    ];

    /**
     * @return integer 店铺ID
     */
    public function getCompanyId() {
        return $this->user ? $this->user->getCompanyId() : 0;
    }

}
